package day03;

import java.util.Scanner;

public class PayTax {
	public static void main(String[] args) {
		double pay, tax, salary;
		Scanner sca = new Scanner(System.in);
		System.out.println("请输入工资");
		do {
			pay = sca.nextDouble();
			System.out.println("请重新输入");
		} while (pay < 2000);
		salary = pay - 2000;
		System.out.println("你的工资是:" + pay);
		if (salary >= 0 && salary < 500) {
			tax = (salary * 0.05);
			System.out.println("你需要交的个人所得税是:" + tax);
		} else if (salary >= 500 && salary < 2000) {
			tax = 500 * 0.05 + (salary - 500) * 0.1;
			System.out.println("你需要交的个人所得税是:" + tax);
		} else if (salary >= 2000 && salary < 5000) {
			tax = 500 * 0.05 + 1500 * 0.1 + (salary - 2000) * 0.15;
			System.out.println("你需要交的个人所得税是:" + tax);
		}
	}
}
